{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "from sklearn.model_selection import train_test_split\n",
    "import os\n",
    "import tqdm\n",
    "from sklearn.linear_model import LogisticRegression\n",
    "from sklearn.model_selection import cross_val_score\n",
    "from sklearn.metrics import confusion_matrix\n",
    "from sklearn.metrics import accuracy_score\n",
    "from sklearn.metrics import roc_auc_score\n",
    "from sklearn.metrics import roc_curve\n",
    "from sklearn.metrics import cohen_kappa_score\n",
    "from sklearn.metrics import precision_recall_curve\n",
    "from sklearn.model_selection import cross_val_score\n",
    "from sklearn.metrics import confusion_matrix,recall_score, auc, roc_curve,precision_score,accuracy_score\n",
    "import variable_bin_methods as vbm\n",
    "import pickle\n",
    "import copy\n",
    "import matplotlib\n",
    "import matplotlib.pyplot as plt\n",
    "import matplotlib.pyplot as plt\n",
    "matplotlib.rcParams['font.sans-serif']=['SimHei']   \n",
    "matplotlib.rcParams['axes.unicode_minus']=False \n",
    "from sklearn.model_selection import GridSearchCV\n",
    "import warnings\n",
    "warnings.filterwarnings(\"ignore\") ##忽略警告\n",
    "from statsmodels.stats.outliers_influence import variance_inflation_factor"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 读取数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_train = pd.read_excel('2018年数据分箱后18个特征数据入模训练集.xlsx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "bin_var=['term','fico_range_high','installment','tot_hi_cred_lim','mort_acc','bc_open_to_buy','home_ownership',\n",
    "        'verification_status','open_rv_24m','bc_util','loan_status']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_train =data_train[bin_var]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "all_woe_x = data_train.drop(columns = ['loan_status'])\n",
    "all_woe_y = data_train['loan_status']\n",
    "X_train, X_test, y_train, y_test = train_test_split(all_woe_x,all_woe_y,random_state = 0,test_size = 0.2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    155666\n",
       "1     52453\n",
       "Name: loan_status, dtype: int64"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_train.value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    39037\n",
       "1    12993\n",
       "Name: loan_status, dtype: int64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_test.value_counts()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 模型训练"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 网格搜索"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "lr_param = {'C':[0.01,0.1,0.2,0.5,1,1.5,2],\n",
    "            'class_weight':[{1:1,0:1},{1:2,0:1},{1:3,0:1}]}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "lr_gsearch = GridSearchCV(\n",
    "    estimator = LogisticRegression(random_state = 0,fit_intercept = True,penalty = 'l2',solver = 'saga'),\n",
    "    param_grid = lr_param,cv = 3,n_jobs = -1,verbose = 2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Fitting 3 folds for each of 21 candidates, totalling 63 fits\n",
      "logistic model best_score_ is 0.7535496518818561,and best_params_ is {'C': 0.1, 'class_weight': {1: 1, 0: 1}}\n"
     ]
    }
   ],
   "source": [
    "lr_gsearch.fit(X_train,y_train)\n",
    "print('logistic model best_score_ is {0},and best_params_ is {1}'.format(lr_gsearch.best_score_,\n",
    "                                   lr_gsearch.best_params_))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 训练模型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "LR_model = LogisticRegression(C = 0.01,penalty = 'l2',solver = 'saga',\n",
    "                                class_weight = {1: 1, 0: 1})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "LR_model_fit = LR_model.fit(X_train,y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "## 保存模型\n",
    "LR_model_save = open('LR_model_fit.pkl','wb')\n",
    "pickle.dump(LR_model_fit,LR_model_save)\n",
    "LR_model_save.close()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 模型预测"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "y_pred_lr = LR_model_fit.predict(X_test)\n",
    "y_proba_lr = LR_model_fit.predict_proba(X_test)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 模型评估"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 混淆矩阵"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>预测为好</th>\n",
       "      <th>预测为坏</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>标签为好</th>\n",
       "      <td>37977</td>\n",
       "      <td>1060</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>标签为坏</th>\n",
       "      <td>11645</td>\n",
       "      <td>1348</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       预测为好  预测为坏\n",
       "标签为好  37977  1060\n",
       "标签为坏  11645  1348"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cm_lr_1 = confusion_matrix(y_test,y_pred_lr)\n",
    "cm_lr_1 = pd.DataFrame(cm_lr_1,index = [\"标签为好\",\"标签为坏\"],columns = ['预测为好','预测为坏'])\n",
    "cm_lr_1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 评估指标"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>准确率</th>\n",
       "      <th>AUC</th>\n",
       "      <th>KS值</th>\n",
       "      <th>kappa</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>逻辑回归</th>\n",
       "      <td>0.755814</td>\n",
       "      <td>0.684153</td>\n",
       "      <td>0.263114</td>\n",
       "      <td>0.105177</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           准确率       AUC       KS值     kappa\n",
       "逻辑回归  0.755814  0.684153  0.263114  0.105177"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "acc_lr_1 = accuracy_score(y_test,y_pred_lr)\n",
    "kappa_lr = cohen_kappa_score(y_test,y_pred_lr)\n",
    "auc_lr = roc_auc_score(y_test, y_proba_lr[:,1])\n",
    "fpr_lr, tpr_lr, thresholds_roc_lr = roc_curve(y_test,y_proba_lr[:,1])\n",
    "ks_lr = max([trp_ - fpr_ for trp_, fpr_ in zip(tpr_lr, fpr_lr)])\n",
    "results = pd.DataFrame()\n",
    "results['准确率'] = [acc_lr_1]\n",
    "results['AUC'] = [auc_lr]\n",
    "results['KS值'] = [ks_lr]\n",
    "results['kappa'] = [kappa_lr]\n",
    "results.index = ['逻辑回归']\n",
    "results"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## ROC、KS曲线"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAacAAAEYCAYAAAD4czk4AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAABBqElEQVR4nO3dd3xUVfrH8c9JBRJCDaEmtNAhlNARQQS7LqxiBXtb17LurmV11XV1/emqu5bVFXvdFRREQZoovRmkE2pIIb33Puf3xw0rYMrMZGbuncnzfr18JZI7937R3Hnm3nvOc5TWGiGEEMJK/MwOIIQQQpxNipMQQgjLkeIkhBDCcqQ4CSGEsBwpTk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eou13yZ+ARFx/b7gzAfOAg8AIwTil1rwkZNgFRwH1AfN12LqW1LrJjsUx3/l5a4bxw6BhuPDfsyuGB88OuHLj/HHEki9efK2YWpxJ+vgQPbSCLPdu4OwNKqY7Aa8AtLj6+vRkeAd7QWhe44fj2ZhgFLNBaZwCfANNNyPAkcJfW+mngEHCzizPYy52/l1Y4L+w+hpvPDXtzuPv8sDeHu88RR7J4/bliZnHayc+XeDFAopPbuDVD3aeyRcCjWuvGmtW6LQNwPnCPUmodMFIp9Y4JGY4Bfeu+j6Xxxr3uytABGK6U8gfGA2ZN0nPn76UVzgu7juGBc8OuHLj//LA3h7vPEUeyeP+5orU25R8gDNgDvIxx2RkDPNPENu1MyHA3kA+sq/vnak9nOGv7dSb9v2iL8Ua0AdgK9DAhwzjgAMansTVAqBt/P9fVfR3iyd9LK5wXDuRw67lhb476/r+Z9N/DreeIg1m8/lwxtUNE3WiPmcAGbVwKO7WNuzO4m2SwTgZ7uTOrFc4LTx1Dcnh/lqY4m1XaFwkhhLAc6RAhhBDCcqQ4CSGEsBwpTkIIISxHipMQQgjLkeIkhBDCcv4f0NxOoIFquj8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "y_proba = y_proba_lr\n",
    "fig,(axe1,axe2) = plt.subplots(1,2,sharey = True)\n",
    "for i in range(len(np.unique(y_test))):\n",
    "    fpr,tpr,thresholds = roc_curve(y_test,y_proba[:,i],pos_label = i)\n",
    "axe1.plot(fpr,tpr)\n",
    "axe1.plot([0,1],[0,1])\n",
    "axe1.set_title('ROC')\n",
    "axe2.plot(1 - thresholds,tpr,label = 'TPR')\n",
    "axe2.plot(1 - thresholds,fpr,label = 'FPR')\n",
    "plt.xlim(0,)\n",
    "axe2.set_title('KS')\n",
    "plt.tight_layout()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#  评分卡"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 特征变量权重"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "weights_dict = dict(zip(list(X_train.columns) + ['截距项'],list(LR_model.coef_.flatten()) + list(LR_model.intercept_)))\n",
    "weights_df = pd.DataFrame.from_dict(weights_dict,orient = 'index',columns = ['权重'])\n",
    "weights_df = weights_df.reset_index().rename(columns = {'index':'特征变量'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>特征变量</th>\n",
       "      <th>权重</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>term</td>\n",
       "      <td>0.951171</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>fico_range_high</td>\n",
       "      <td>0.604563</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>installment</td>\n",
       "      <td>0.836951</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>tot_hi_cred_lim</td>\n",
       "      <td>0.621536</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>mort_acc</td>\n",
       "      <td>0.545059</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>bc_open_to_buy</td>\n",
       "      <td>0.616086</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>home_ownership</td>\n",
       "      <td>0.365080</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>verification_status</td>\n",
       "      <td>0.582390</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>open_rv_24m</td>\n",
       "      <td>0.894676</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>bc_util</td>\n",
       "      <td>-0.062275</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>截距项</td>\n",
       "      <td>-1.086121</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   特征变量        权重\n",
       "0                  term  0.951171\n",
       "1       fico_range_high  0.604563\n",
       "2           installment  0.836951\n",
       "3       tot_hi_cred_lim  0.621536\n",
       "4              mort_acc  0.545059\n",
       "5        bc_open_to_buy  0.616086\n",
       "6        home_ownership  0.365080\n",
       "7   verification_status  0.582390\n",
       "8           open_rv_24m  0.894676\n",
       "9               bc_util -0.062275\n",
       "10                  截距项 -1.086121"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "weights_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 计算基础分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "s0 = 600\n",
    "theta0 = 1 / 60\n",
    "PDO = 20\n",
    "B = PDO / np.log(2)\n",
    "A = s0 + B * np.log(theta0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(481.8621880878296, 28.85390081777927)"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A,B"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "base_points = round(A - B * weights_dict.get('截距项'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "513"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "base_points"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 计算各箱分值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "data= pd.read_excel('2018年数据分箱后18个特征数据.xlsx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "data=data[bin_var]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>term</th>\n",
       "      <th>fico_range_high</th>\n",
       "      <th>installment</th>\n",
       "      <th>tot_hi_cred_lim</th>\n",
       "      <th>mort_acc</th>\n",
       "      <th>bc_open_to_buy</th>\n",
       "      <th>home_ownership</th>\n",
       "      <th>verification_status</th>\n",
       "      <th>open_rv_24m</th>\n",
       "      <th>bc_util</th>\n",
       "      <th>loan_status</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>260144</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>260145</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>260146</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>260147</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>260148</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>260149 rows × 11 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        term  fico_range_high  installment  tot_hi_cred_lim  mort_acc  \\\n",
       "0          1                0            3                2         2   \n",
       "1          0                2            3                2         3   \n",
       "2          0                1            1                1         0   \n",
       "3          0                2            1                2         0   \n",
       "4          0                3            2                4         1   \n",
       "...      ...              ...          ...              ...       ...   \n",
       "260144     1                0            3                2         1   \n",
       "260145     0                1            1                0         0   \n",
       "260146     0                1            3                1         2   \n",
       "260147     0                0            1                2         0   \n",
       "260148     0                1            4                3         3   \n",
       "\n",
       "        bc_open_to_buy  home_ownership  verification_status  open_rv_24m  \\\n",
       "0                    3               1                    1            3   \n",
       "1                    3               1                    2            0   \n",
       "2                    0               2                    0            0   \n",
       "3                    3               0                    1            1   \n",
       "4                    2               0                    1            1   \n",
       "...                ...             ...                  ...          ...   \n",
       "260144               0               0                    0            1   \n",
       "260145               0               1                    1            3   \n",
       "260146               0               1                    0            0   \n",
       "260147               0               0                    1            3   \n",
       "260148               4               0                    1            3   \n",
       "\n",
       "        bc_util  loan_status  \n",
       "0             1            0  \n",
       "1             5            0  \n",
       "2             5            0  \n",
       "3             1            0  \n",
       "4             2            0  \n",
       "...         ...          ...  \n",
       "260144        3            0  \n",
       "260145        3            0  \n",
       "260146        5            0  \n",
       "260147        5            0  \n",
       "260148        3            1  \n",
       "\n",
       "[260149 rows x 11 columns]"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "def WOE_IV(data,col_x,col_y):\n",
    "    a = data.pivot_table(index = col_x,values = col_y,aggfunc = ['sum','count'])\n",
    "    a_df = pd.DataFrame(a.values,index = a.index,columns = ['标签为‘1’样本数','样本数'])\n",
    "    a_df['标签为‘0’样本数'] = a_df['样本数'] - a_df['标签为‘1’样本数']\n",
    "    a_df['标签为‘1’样本占比'] = a_df['标签为‘1’样本数'] / a_df['样本数']\n",
    "    p_1 = a_df['标签为‘1’样本数'].replace([0],[1]) / np.sum(a_df['标签为‘1’样本数'])\n",
    "    p_0 = a_df['标签为‘0’样本数'].replace([0],[1]) / np.sum(a_df['标签为‘0’样本数'])\n",
    "    a_df['WOE'] = np.log(p_1 / p_0)\n",
    "    a_df['IV'] = (p_1 - p_0) * a_df['WOE']\n",
    "    a_df = a_df[['标签为‘1’样本数','标签为‘0’样本数','样本数','标签为‘1’样本占比','WOE','IV']]\n",
    "    iv = a_df.sum()['IV']\n",
    "    woe = a_df['WOE'].apply(lambda x: round(x,4))\n",
    "    a_df = a_df.apply(lambda x: round(x,4))\n",
    "    return a_df,round(iv,4),woe"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "col_y = 'loan_status'\n",
    "woe_dict = dict()\n",
    "for col in X_train.columns:\n",
    "    table_sss,iv_sss,woe_sss = WOE_IV(data,col,col_y)\n",
    "    woe_dict[col] = dict(woe_sss)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "bin_score = []\n",
    "for coli in X_train.columns:\n",
    "    for bini in woe_dict.get(coli).keys():\n",
    "        bin_score.append([coli,bini,round(-B * woe_dict.get(coli).get(bini) * weights_dict.get(coli),2)])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "bin_score_df = pd.DataFrame(bin_score,columns = ['特征变量','变量分箱值','分值'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>特征变量</th>\n",
       "      <th>变量分箱值</th>\n",
       "      <th>分值</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>term</td>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>term</td>\n",
       "      <td>1</td>\n",
       "      <td>-16.05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>fico_range_high</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>fico_range_high</td>\n",
       "      <td>1</td>\n",
       "      <td>-1.78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>fico_range_high</td>\n",
       "      <td>2</td>\n",
       "      <td>3.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>fico_range_high</td>\n",
       "      <td>3</td>\n",
       "      <td>11.22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>fico_range_high</td>\n",
       "      <td>4</td>\n",
       "      <td>18.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>installment</td>\n",
       "      <td>0</td>\n",
       "      <td>16.68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>installment</td>\n",
       "      <td>1</td>\n",
       "      <td>4.28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>installment</td>\n",
       "      <td>2</td>\n",
       "      <td>-1.77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>installment</td>\n",
       "      <td>3</td>\n",
       "      <td>-5.37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>installment</td>\n",
       "      <td>4</td>\n",
       "      <td>-6.65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>tot_hi_cred_lim</td>\n",
       "      <td>0</td>\n",
       "      <td>-6.37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>tot_hi_cred_lim</td>\n",
       "      <td>1</td>\n",
       "      <td>-2.95</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>tot_hi_cred_lim</td>\n",
       "      <td>2</td>\n",
       "      <td>2.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>tot_hi_cred_lim</td>\n",
       "      <td>3</td>\n",
       "      <td>5.56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>tot_hi_cred_lim</td>\n",
       "      <td>4</td>\n",
       "      <td>9.43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>mort_acc</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>mort_acc</td>\n",
       "      <td>1</td>\n",
       "      <td>3.27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>mort_acc</td>\n",
       "      <td>2</td>\n",
       "      <td>5.22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>mort_acc</td>\n",
       "      <td>3</td>\n",
       "      <td>7.21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>bc_open_to_buy</td>\n",
       "      <td>0</td>\n",
       "      <td>-3.98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>bc_open_to_buy</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>bc_open_to_buy</td>\n",
       "      <td>2</td>\n",
       "      <td>0.84</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>bc_open_to_buy</td>\n",
       "      <td>3</td>\n",
       "      <td>1.92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>bc_open_to_buy</td>\n",
       "      <td>4</td>\n",
       "      <td>4.91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>bc_open_to_buy</td>\n",
       "      <td>5</td>\n",
       "      <td>10.38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>home_ownership</td>\n",
       "      <td>0</td>\n",
       "      <td>2.47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>home_ownership</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.81</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>home_ownership</td>\n",
       "      <td>2</td>\n",
       "      <td>-2.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>verification_status</td>\n",
       "      <td>0</td>\n",
       "      <td>4.05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>verification_status</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>verification_status</td>\n",
       "      <td>2</td>\n",
       "      <td>-5.39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>open_rv_24m</td>\n",
       "      <td>0</td>\n",
       "      <td>3.63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>open_rv_24m</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>open_rv_24m</td>\n",
       "      <td>2</td>\n",
       "      <td>-3.44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>open_rv_24m</td>\n",
       "      <td>3</td>\n",
       "      <td>-6.11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>open_rv_24m</td>\n",
       "      <td>4</td>\n",
       "      <td>-9.86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>bc_util</td>\n",
       "      <td>0</td>\n",
       "      <td>-0.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>bc_util</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>bc_util</td>\n",
       "      <td>2</td>\n",
       "      <td>-0.07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>bc_util</td>\n",
       "      <td>3</td>\n",
       "      <td>0.07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>bc_util</td>\n",
       "      <td>4</td>\n",
       "      <td>0.21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>bc_util</td>\n",
       "      <td>5</td>\n",
       "      <td>0.35</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   特征变量  变量分箱值     分值\n",
       "0                  term      0   6.83\n",
       "1                  term      1 -16.05\n",
       "2       fico_range_high      0  -5.02\n",
       "3       fico_range_high      1  -1.78\n",
       "4       fico_range_high      2   3.75\n",
       "5       fico_range_high      3  11.22\n",
       "6       fico_range_high      4  18.49\n",
       "7           installment      0  16.68\n",
       "8           installment      1   4.28\n",
       "9           installment      2  -1.77\n",
       "10          installment      3  -5.37\n",
       "11          installment      4  -6.65\n",
       "12      tot_hi_cred_lim      0  -6.37\n",
       "13      tot_hi_cred_lim      1  -2.95\n",
       "14      tot_hi_cred_lim      2   2.48\n",
       "15      tot_hi_cred_lim      3   5.56\n",
       "16      tot_hi_cred_lim      4   9.43\n",
       "17             mort_acc      0  -2.61\n",
       "18             mort_acc      1   3.27\n",
       "19             mort_acc      2   5.22\n",
       "20             mort_acc      3   7.21\n",
       "21       bc_open_to_buy      0  -3.98\n",
       "22       bc_open_to_buy      1  -0.75\n",
       "23       bc_open_to_buy      2   0.84\n",
       "24       bc_open_to_buy      3   1.92\n",
       "25       bc_open_to_buy      4   4.91\n",
       "26       bc_open_to_buy      5  10.38\n",
       "27       home_ownership      0   2.47\n",
       "28       home_ownership      1  -0.81\n",
       "29       home_ownership      2  -2.50\n",
       "30  verification_status      0   4.05\n",
       "31  verification_status      1  -0.73\n",
       "32  verification_status      2  -5.39\n",
       "33          open_rv_24m      0   3.63\n",
       "34          open_rv_24m      1  -0.83\n",
       "35          open_rv_24m      2  -3.44\n",
       "36          open_rv_24m      3  -6.11\n",
       "37          open_rv_24m      4  -9.86\n",
       "38              bc_util      0  -0.49\n",
       "39              bc_util      1  -0.22\n",
       "40              bc_util      2  -0.07\n",
       "41              bc_util      3   0.07\n",
       "42              bc_util      4   0.21\n",
       "43              bc_util      5   0.35"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "bin_score_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "bin_score_df_list = []\n",
    "for i in set(bin_score_df['特征变量']):\n",
    "    bin_score_df_list.append(bin_score_df[bin_score_df['特征变量'] == i][['变量分箱值','分值']].set_index('变量分箱值'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "bin_score_df_ = pd.concat(bin_score_df_list,keys = list(set(bin_score_df['特征变量'])))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>分值</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>变量分箱值</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"6\" valign=\"top\">bc_open_to_buy</th>\n",
       "      <th>0</th>\n",
       "      <td>-3.98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-0.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.84</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1.92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4.91</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>10.38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">verification_status</th>\n",
       "      <th>0</th>\n",
       "      <td>4.05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-0.73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-5.39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">open_rv_24m</th>\n",
       "      <th>0</th>\n",
       "      <td>3.63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-0.83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-3.44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-6.11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-9.86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"6\" valign=\"top\">bc_util</th>\n",
       "      <th>0</th>\n",
       "      <td>-0.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-0.22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-0.07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0.35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">installment</th>\n",
       "      <th>0</th>\n",
       "      <td>16.68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>4.28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-1.77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-5.37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-6.65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">home_ownership</th>\n",
       "      <th>0</th>\n",
       "      <td>2.47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-0.81</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-2.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">term</th>\n",
       "      <th>0</th>\n",
       "      <td>6.83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-16.05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">tot_hi_cred_lim</th>\n",
       "      <th>0</th>\n",
       "      <td>-6.37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-2.95</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>5.56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>9.43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"4\" valign=\"top\">mort_acc</th>\n",
       "      <th>0</th>\n",
       "      <td>-2.61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>3.27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>5.22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>7.21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">fico_range_high</th>\n",
       "      <th>0</th>\n",
       "      <td>-5.02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-1.78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>11.22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>18.49</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                              分值\n",
       "                    变量分箱值       \n",
       "bc_open_to_buy      0      -3.98\n",
       "                    1      -0.75\n",
       "                    2       0.84\n",
       "                    3       1.92\n",
       "                    4       4.91\n",
       "                    5      10.38\n",
       "verification_status 0       4.05\n",
       "                    1      -0.73\n",
       "                    2      -5.39\n",
       "open_rv_24m         0       3.63\n",
       "                    1      -0.83\n",
       "                    2      -3.44\n",
       "                    3      -6.11\n",
       "                    4      -9.86\n",
       "bc_util             0      -0.49\n",
       "                    1      -0.22\n",
       "                    2      -0.07\n",
       "                    3       0.07\n",
       "                    4       0.21\n",
       "                    5       0.35\n",
       "installment         0      16.68\n",
       "                    1       4.28\n",
       "                    2      -1.77\n",
       "                    3      -5.37\n",
       "                    4      -6.65\n",
       "home_ownership      0       2.47\n",
       "                    1      -0.81\n",
       "                    2      -2.50\n",
       "term                0       6.83\n",
       "                    1     -16.05\n",
       "tot_hi_cred_lim     0      -6.37\n",
       "                    1      -2.95\n",
       "                    2       2.48\n",
       "                    3       5.56\n",
       "                    4       9.43\n",
       "mort_acc            0      -2.61\n",
       "                    1       3.27\n",
       "                    2       5.22\n",
       "                    3       7.21\n",
       "fico_range_high     0      -5.02\n",
       "                    1      -1.78\n",
       "                    2       3.75\n",
       "                    3      11.22\n",
       "                    4      18.49"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "bin_score_df_"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 样本打分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_pingfen= pd.read_excel('2019第一季度数据用于评分卡打分的分箱数据.xlsx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_pingfen=data_pingfen[bin_var]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['term', 'fico_range_high', 'installment', 'tot_hi_cred_lim', 'mort_acc',\n",
       "       'bc_open_to_buy', 'home_ownership', 'verification_status',\n",
       "       'open_rv_24m', 'bc_util'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_pingfen.columns[0:-1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "for col in data_pingfen.columns[0:-1]:\n",
    "    x = data_pingfen[col]\n",
    "    old_values = list(bin_score_df_.loc[col].index)\n",
    "    new_values = list(bin_score_df_.loc[col]['分值'])\n",
    "    data_pingfen[col + '得分'] = x.replace(old_values,new_values)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "sort_coulmns = ['term','term得分','fico_range_high','fico_range_high得分',\n",
    "                'installment','installment得分','tot_hi_cred_lim','tot_hi_cred_lim得分','mort_acc','mort_acc得分',\n",
    "                'bc_open_to_buy','bc_open_to_buy得分','home_ownership','home_ownership得分','verification_status','verification_status得分',\n",
    "                'open_rv_24m','open_rv_24m得分','bc_util','bc_util得分','loan_status']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_pingfen_bins = data_pingfen[sort_coulmns]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>term</th>\n",
       "      <th>term得分</th>\n",
       "      <th>fico_range_high</th>\n",
       "      <th>fico_range_high得分</th>\n",
       "      <th>installment</th>\n",
       "      <th>installment得分</th>\n",
       "      <th>tot_hi_cred_lim</th>\n",
       "      <th>tot_hi_cred_lim得分</th>\n",
       "      <th>mort_acc</th>\n",
       "      <th>mort_acc得分</th>\n",
       "      <th>...</th>\n",
       "      <th>bc_open_to_buy得分</th>\n",
       "      <th>home_ownership</th>\n",
       "      <th>home_ownership得分</th>\n",
       "      <th>verification_status</th>\n",
       "      <th>verification_status得分</th>\n",
       "      <th>open_rv_24m</th>\n",
       "      <th>open_rv_24m得分</th>\n",
       "      <th>bc_util</th>\n",
       "      <th>bc_util得分</th>\n",
       "      <th>loan_status</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>1</td>\n",
       "      <td>4.28</td>\n",
       "      <td>1</td>\n",
       "      <td>-2.95</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>-3.98</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.81</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.73</td>\n",
       "      <td>0</td>\n",
       "      <td>3.63</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.22</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>3</td>\n",
       "      <td>-5.37</td>\n",
       "      <td>3</td>\n",
       "      <td>5.56</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>1.92</td>\n",
       "      <td>0</td>\n",
       "      <td>2.47</td>\n",
       "      <td>2</td>\n",
       "      <td>-5.39</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.83</td>\n",
       "      <td>4</td>\n",
       "      <td>0.21</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>3</td>\n",
       "      <td>11.22</td>\n",
       "      <td>0</td>\n",
       "      <td>16.68</td>\n",
       "      <td>1</td>\n",
       "      <td>-2.95</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>4.91</td>\n",
       "      <td>2</td>\n",
       "      <td>-2.50</td>\n",
       "      <td>0</td>\n",
       "      <td>4.05</td>\n",
       "      <td>0</td>\n",
       "      <td>3.63</td>\n",
       "      <td>0</td>\n",
       "      <td>-0.49</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>0</td>\n",
       "      <td>16.68</td>\n",
       "      <td>0</td>\n",
       "      <td>-6.37</td>\n",
       "      <td>2</td>\n",
       "      <td>5.22</td>\n",
       "      <td>...</td>\n",
       "      <td>-3.98</td>\n",
       "      <td>2</td>\n",
       "      <td>-2.50</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.73</td>\n",
       "      <td>2</td>\n",
       "      <td>-3.44</td>\n",
       "      <td>5</td>\n",
       "      <td>0.35</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>0</td>\n",
       "      <td>16.68</td>\n",
       "      <td>2</td>\n",
       "      <td>2.48</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>1.92</td>\n",
       "      <td>2</td>\n",
       "      <td>-2.50</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.73</td>\n",
       "      <td>3</td>\n",
       "      <td>-6.11</td>\n",
       "      <td>3</td>\n",
       "      <td>0.07</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40910</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>2</td>\n",
       "      <td>3.75</td>\n",
       "      <td>1</td>\n",
       "      <td>4.28</td>\n",
       "      <td>3</td>\n",
       "      <td>5.56</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>4.91</td>\n",
       "      <td>0</td>\n",
       "      <td>2.47</td>\n",
       "      <td>0</td>\n",
       "      <td>4.05</td>\n",
       "      <td>3</td>\n",
       "      <td>-6.11</td>\n",
       "      <td>0</td>\n",
       "      <td>-0.49</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40911</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>3</td>\n",
       "      <td>11.22</td>\n",
       "      <td>3</td>\n",
       "      <td>-5.37</td>\n",
       "      <td>1</td>\n",
       "      <td>-2.95</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>10.38</td>\n",
       "      <td>2</td>\n",
       "      <td>-2.50</td>\n",
       "      <td>0</td>\n",
       "      <td>4.05</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-0.49</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40912</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>2</td>\n",
       "      <td>3.75</td>\n",
       "      <td>1</td>\n",
       "      <td>4.28</td>\n",
       "      <td>1</td>\n",
       "      <td>-2.95</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>0.84</td>\n",
       "      <td>0</td>\n",
       "      <td>2.47</td>\n",
       "      <td>0</td>\n",
       "      <td>4.05</td>\n",
       "      <td>0</td>\n",
       "      <td>3.63</td>\n",
       "      <td>2</td>\n",
       "      <td>-0.07</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40913</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>3</td>\n",
       "      <td>-5.37</td>\n",
       "      <td>0</td>\n",
       "      <td>-6.37</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>-0.75</td>\n",
       "      <td>0</td>\n",
       "      <td>2.47</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.73</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.83</td>\n",
       "      <td>4</td>\n",
       "      <td>0.21</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40914</th>\n",
       "      <td>1</td>\n",
       "      <td>-16.05</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>2</td>\n",
       "      <td>-1.77</td>\n",
       "      <td>3</td>\n",
       "      <td>5.56</td>\n",
       "      <td>2</td>\n",
       "      <td>5.22</td>\n",
       "      <td>...</td>\n",
       "      <td>-0.75</td>\n",
       "      <td>0</td>\n",
       "      <td>2.47</td>\n",
       "      <td>2</td>\n",
       "      <td>-5.39</td>\n",
       "      <td>0</td>\n",
       "      <td>3.63</td>\n",
       "      <td>3</td>\n",
       "      <td>0.07</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>40915 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       term  term得分  fico_range_high  fico_range_high得分  installment  \\\n",
       "0         0    6.83                0              -5.02            1   \n",
       "1         0    6.83                0              -5.02            3   \n",
       "2         0    6.83                3              11.22            0   \n",
       "3         0    6.83                0              -5.02            0   \n",
       "4         0    6.83                0              -5.02            0   \n",
       "...     ...     ...              ...                ...          ...   \n",
       "40910     0    6.83                2               3.75            1   \n",
       "40911     0    6.83                3              11.22            3   \n",
       "40912     0    6.83                2               3.75            1   \n",
       "40913     0    6.83                0              -5.02            3   \n",
       "40914     1  -16.05                0              -5.02            2   \n",
       "\n",
       "       installment得分  tot_hi_cred_lim  tot_hi_cred_lim得分  mort_acc  \\\n",
       "0               4.28                1              -2.95         0   \n",
       "1              -5.37                3               5.56         0   \n",
       "2              16.68                1              -2.95         0   \n",
       "3              16.68                0              -6.37         2   \n",
       "4              16.68                2               2.48         0   \n",
       "...              ...              ...                ...       ...   \n",
       "40910           4.28                3               5.56         0   \n",
       "40911          -5.37                1              -2.95         0   \n",
       "40912           4.28                1              -2.95         0   \n",
       "40913          -5.37                0              -6.37         0   \n",
       "40914          -1.77                3               5.56         2   \n",
       "\n",
       "       mort_acc得分  ...  bc_open_to_buy得分  home_ownership  home_ownership得分  \\\n",
       "0           -2.61  ...             -3.98               1             -0.81   \n",
       "1           -2.61  ...              1.92               0              2.47   \n",
       "2           -2.61  ...              4.91               2             -2.50   \n",
       "3            5.22  ...             -3.98               2             -2.50   \n",
       "4           -2.61  ...              1.92               2             -2.50   \n",
       "...           ...  ...               ...             ...               ...   \n",
       "40910       -2.61  ...              4.91               0              2.47   \n",
       "40911       -2.61  ...             10.38               2             -2.50   \n",
       "40912       -2.61  ...              0.84               0              2.47   \n",
       "40913       -2.61  ...             -0.75               0              2.47   \n",
       "40914        5.22  ...             -0.75               0              2.47   \n",
       "\n",
       "       verification_status  verification_status得分  open_rv_24m  open_rv_24m得分  \\\n",
       "0                        1                  -0.73            0           3.63   \n",
       "1                        2                  -5.39            1          -0.83   \n",
       "2                        0                   4.05            0           3.63   \n",
       "3                        1                  -0.73            2          -3.44   \n",
       "4                        1                  -0.73            3          -6.11   \n",
       "...                    ...                    ...          ...            ...   \n",
       "40910                    0                   4.05            3          -6.11   \n",
       "40911                    0                   4.05            1          -0.83   \n",
       "40912                    0                   4.05            0           3.63   \n",
       "40913                    1                  -0.73            1          -0.83   \n",
       "40914                    2                  -5.39            0           3.63   \n",
       "\n",
       "       bc_util  bc_util得分  loan_status  \n",
       "0            1      -0.22            0  \n",
       "1            4       0.21            0  \n",
       "2            0      -0.49            0  \n",
       "3            5       0.35            0  \n",
       "4            3       0.07            0  \n",
       "...        ...        ...          ...  \n",
       "40910        0      -0.49            0  \n",
       "40911        0      -0.49            0  \n",
       "40912        2      -0.07            0  \n",
       "40913        4       0.21            1  \n",
       "40914        3       0.07            0  \n",
       "\n",
       "[40915 rows x 21 columns]"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_pingfen_bins"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_pingfen_bins['基础分'] = [base_points] * data_pingfen_bins.shape[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>term</th>\n",
       "      <th>term得分</th>\n",
       "      <th>fico_range_high</th>\n",
       "      <th>fico_range_high得分</th>\n",
       "      <th>installment</th>\n",
       "      <th>installment得分</th>\n",
       "      <th>tot_hi_cred_lim</th>\n",
       "      <th>tot_hi_cred_lim得分</th>\n",
       "      <th>mort_acc</th>\n",
       "      <th>mort_acc得分</th>\n",
       "      <th>...</th>\n",
       "      <th>home_ownership</th>\n",
       "      <th>home_ownership得分</th>\n",
       "      <th>verification_status</th>\n",
       "      <th>verification_status得分</th>\n",
       "      <th>open_rv_24m</th>\n",
       "      <th>open_rv_24m得分</th>\n",
       "      <th>bc_util</th>\n",
       "      <th>bc_util得分</th>\n",
       "      <th>loan_status</th>\n",
       "      <th>基础分</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>1</td>\n",
       "      <td>4.28</td>\n",
       "      <td>1</td>\n",
       "      <td>-2.95</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.81</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.73</td>\n",
       "      <td>0</td>\n",
       "      <td>3.63</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.22</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>3</td>\n",
       "      <td>-5.37</td>\n",
       "      <td>3</td>\n",
       "      <td>5.56</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>2.47</td>\n",
       "      <td>2</td>\n",
       "      <td>-5.39</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.83</td>\n",
       "      <td>4</td>\n",
       "      <td>0.21</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>3</td>\n",
       "      <td>11.22</td>\n",
       "      <td>0</td>\n",
       "      <td>16.68</td>\n",
       "      <td>1</td>\n",
       "      <td>-2.95</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>2</td>\n",
       "      <td>-2.50</td>\n",
       "      <td>0</td>\n",
       "      <td>4.05</td>\n",
       "      <td>0</td>\n",
       "      <td>3.63</td>\n",
       "      <td>0</td>\n",
       "      <td>-0.49</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>0</td>\n",
       "      <td>16.68</td>\n",
       "      <td>0</td>\n",
       "      <td>-6.37</td>\n",
       "      <td>2</td>\n",
       "      <td>5.22</td>\n",
       "      <td>...</td>\n",
       "      <td>2</td>\n",
       "      <td>-2.50</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.73</td>\n",
       "      <td>2</td>\n",
       "      <td>-3.44</td>\n",
       "      <td>5</td>\n",
       "      <td>0.35</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>0</td>\n",
       "      <td>16.68</td>\n",
       "      <td>2</td>\n",
       "      <td>2.48</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>2</td>\n",
       "      <td>-2.50</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.73</td>\n",
       "      <td>3</td>\n",
       "      <td>-6.11</td>\n",
       "      <td>3</td>\n",
       "      <td>0.07</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40910</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>2</td>\n",
       "      <td>3.75</td>\n",
       "      <td>1</td>\n",
       "      <td>4.28</td>\n",
       "      <td>3</td>\n",
       "      <td>5.56</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>2.47</td>\n",
       "      <td>0</td>\n",
       "      <td>4.05</td>\n",
       "      <td>3</td>\n",
       "      <td>-6.11</td>\n",
       "      <td>0</td>\n",
       "      <td>-0.49</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40911</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>3</td>\n",
       "      <td>11.22</td>\n",
       "      <td>3</td>\n",
       "      <td>-5.37</td>\n",
       "      <td>1</td>\n",
       "      <td>-2.95</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>2</td>\n",
       "      <td>-2.50</td>\n",
       "      <td>0</td>\n",
       "      <td>4.05</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-0.49</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40912</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>2</td>\n",
       "      <td>3.75</td>\n",
       "      <td>1</td>\n",
       "      <td>4.28</td>\n",
       "      <td>1</td>\n",
       "      <td>-2.95</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>2.47</td>\n",
       "      <td>0</td>\n",
       "      <td>4.05</td>\n",
       "      <td>0</td>\n",
       "      <td>3.63</td>\n",
       "      <td>2</td>\n",
       "      <td>-0.07</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40913</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>3</td>\n",
       "      <td>-5.37</td>\n",
       "      <td>0</td>\n",
       "      <td>-6.37</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>2.47</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.73</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.83</td>\n",
       "      <td>4</td>\n",
       "      <td>0.21</td>\n",
       "      <td>1</td>\n",
       "      <td>513</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40914</th>\n",
       "      <td>1</td>\n",
       "      <td>-16.05</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>2</td>\n",
       "      <td>-1.77</td>\n",
       "      <td>3</td>\n",
       "      <td>5.56</td>\n",
       "      <td>2</td>\n",
       "      <td>5.22</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>2.47</td>\n",
       "      <td>2</td>\n",
       "      <td>-5.39</td>\n",
       "      <td>0</td>\n",
       "      <td>3.63</td>\n",
       "      <td>3</td>\n",
       "      <td>0.07</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>40915 rows × 22 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       term  term得分  fico_range_high  fico_range_high得分  installment  \\\n",
       "0         0    6.83                0              -5.02            1   \n",
       "1         0    6.83                0              -5.02            3   \n",
       "2         0    6.83                3              11.22            0   \n",
       "3         0    6.83                0              -5.02            0   \n",
       "4         0    6.83                0              -5.02            0   \n",
       "...     ...     ...              ...                ...          ...   \n",
       "40910     0    6.83                2               3.75            1   \n",
       "40911     0    6.83                3              11.22            3   \n",
       "40912     0    6.83                2               3.75            1   \n",
       "40913     0    6.83                0              -5.02            3   \n",
       "40914     1  -16.05                0              -5.02            2   \n",
       "\n",
       "       installment得分  tot_hi_cred_lim  tot_hi_cred_lim得分  mort_acc  \\\n",
       "0               4.28                1              -2.95         0   \n",
       "1              -5.37                3               5.56         0   \n",
       "2              16.68                1              -2.95         0   \n",
       "3              16.68                0              -6.37         2   \n",
       "4              16.68                2               2.48         0   \n",
       "...              ...              ...                ...       ...   \n",
       "40910           4.28                3               5.56         0   \n",
       "40911          -5.37                1              -2.95         0   \n",
       "40912           4.28                1              -2.95         0   \n",
       "40913          -5.37                0              -6.37         0   \n",
       "40914          -1.77                3               5.56         2   \n",
       "\n",
       "       mort_acc得分  ...  home_ownership  home_ownership得分  verification_status  \\\n",
       "0           -2.61  ...               1             -0.81                    1   \n",
       "1           -2.61  ...               0              2.47                    2   \n",
       "2           -2.61  ...               2             -2.50                    0   \n",
       "3            5.22  ...               2             -2.50                    1   \n",
       "4           -2.61  ...               2             -2.50                    1   \n",
       "...           ...  ...             ...               ...                  ...   \n",
       "40910       -2.61  ...               0              2.47                    0   \n",
       "40911       -2.61  ...               2             -2.50                    0   \n",
       "40912       -2.61  ...               0              2.47                    0   \n",
       "40913       -2.61  ...               0              2.47                    1   \n",
       "40914        5.22  ...               0              2.47                    2   \n",
       "\n",
       "       verification_status得分  open_rv_24m  open_rv_24m得分  bc_util  bc_util得分  \\\n",
       "0                      -0.73            0           3.63        1      -0.22   \n",
       "1                      -5.39            1          -0.83        4       0.21   \n",
       "2                       4.05            0           3.63        0      -0.49   \n",
       "3                      -0.73            2          -3.44        5       0.35   \n",
       "4                      -0.73            3          -6.11        3       0.07   \n",
       "...                      ...          ...            ...      ...        ...   \n",
       "40910                   4.05            3          -6.11        0      -0.49   \n",
       "40911                   4.05            1          -0.83        0      -0.49   \n",
       "40912                   4.05            0           3.63        2      -0.07   \n",
       "40913                  -0.73            1          -0.83        4       0.21   \n",
       "40914                  -5.39            0           3.63        3       0.07   \n",
       "\n",
       "       loan_status  基础分  \n",
       "0                0  513  \n",
       "1                0  513  \n",
       "2                0  513  \n",
       "3                0  513  \n",
       "4                0  513  \n",
       "...            ...  ...  \n",
       "40910            0  513  \n",
       "40911            0  513  \n",
       "40912            0  513  \n",
       "40913            1  513  \n",
       "40914            0  513  \n",
       "\n",
       "[40915 rows x 22 columns]"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_pingfen_bins"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [],
   "source": [
    "score_df = data_pingfen_bins[['term得分','fico_range_high得分','installment得分','tot_hi_cred_lim得分',\n",
    "                         'mort_acc得分','bc_open_to_buy得分','home_ownership得分','verification_status得分',\n",
    "                         'open_rv_24m得分','bc_util得分','基础分']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_pingfen_bins['总分'] = score_df.sum(axis = 1).values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>term</th>\n",
       "      <th>term得分</th>\n",
       "      <th>fico_range_high</th>\n",
       "      <th>fico_range_high得分</th>\n",
       "      <th>installment</th>\n",
       "      <th>installment得分</th>\n",
       "      <th>tot_hi_cred_lim</th>\n",
       "      <th>tot_hi_cred_lim得分</th>\n",
       "      <th>mort_acc</th>\n",
       "      <th>mort_acc得分</th>\n",
       "      <th>...</th>\n",
       "      <th>home_ownership得分</th>\n",
       "      <th>verification_status</th>\n",
       "      <th>verification_status得分</th>\n",
       "      <th>open_rv_24m</th>\n",
       "      <th>open_rv_24m得分</th>\n",
       "      <th>bc_util</th>\n",
       "      <th>bc_util得分</th>\n",
       "      <th>loan_status</th>\n",
       "      <th>基础分</th>\n",
       "      <th>总分</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>1</td>\n",
       "      <td>4.28</td>\n",
       "      <td>1</td>\n",
       "      <td>-2.95</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>-0.81</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.73</td>\n",
       "      <td>0</td>\n",
       "      <td>3.63</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.22</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "      <td>511.42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>3</td>\n",
       "      <td>-5.37</td>\n",
       "      <td>3</td>\n",
       "      <td>5.56</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>2.47</td>\n",
       "      <td>2</td>\n",
       "      <td>-5.39</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.83</td>\n",
       "      <td>4</td>\n",
       "      <td>0.21</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "      <td>510.77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>3</td>\n",
       "      <td>11.22</td>\n",
       "      <td>0</td>\n",
       "      <td>16.68</td>\n",
       "      <td>1</td>\n",
       "      <td>-2.95</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>-2.50</td>\n",
       "      <td>0</td>\n",
       "      <td>4.05</td>\n",
       "      <td>0</td>\n",
       "      <td>3.63</td>\n",
       "      <td>0</td>\n",
       "      <td>-0.49</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "      <td>551.77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>0</td>\n",
       "      <td>16.68</td>\n",
       "      <td>0</td>\n",
       "      <td>-6.37</td>\n",
       "      <td>2</td>\n",
       "      <td>5.22</td>\n",
       "      <td>...</td>\n",
       "      <td>-2.50</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.73</td>\n",
       "      <td>2</td>\n",
       "      <td>-3.44</td>\n",
       "      <td>5</td>\n",
       "      <td>0.35</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "      <td>520.04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>0</td>\n",
       "      <td>16.68</td>\n",
       "      <td>2</td>\n",
       "      <td>2.48</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>-2.50</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.73</td>\n",
       "      <td>3</td>\n",
       "      <td>-6.11</td>\n",
       "      <td>3</td>\n",
       "      <td>0.07</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "      <td>524.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40910</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>2</td>\n",
       "      <td>3.75</td>\n",
       "      <td>1</td>\n",
       "      <td>4.28</td>\n",
       "      <td>3</td>\n",
       "      <td>5.56</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>2.47</td>\n",
       "      <td>0</td>\n",
       "      <td>4.05</td>\n",
       "      <td>3</td>\n",
       "      <td>-6.11</td>\n",
       "      <td>0</td>\n",
       "      <td>-0.49</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "      <td>535.64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40911</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>3</td>\n",
       "      <td>11.22</td>\n",
       "      <td>3</td>\n",
       "      <td>-5.37</td>\n",
       "      <td>1</td>\n",
       "      <td>-2.95</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>-2.50</td>\n",
       "      <td>0</td>\n",
       "      <td>4.05</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-0.49</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "      <td>530.73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40912</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>2</td>\n",
       "      <td>3.75</td>\n",
       "      <td>1</td>\n",
       "      <td>4.28</td>\n",
       "      <td>1</td>\n",
       "      <td>-2.95</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>2.47</td>\n",
       "      <td>0</td>\n",
       "      <td>4.05</td>\n",
       "      <td>0</td>\n",
       "      <td>3.63</td>\n",
       "      <td>2</td>\n",
       "      <td>-0.07</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "      <td>533.22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40913</th>\n",
       "      <td>0</td>\n",
       "      <td>6.83</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>3</td>\n",
       "      <td>-5.37</td>\n",
       "      <td>0</td>\n",
       "      <td>-6.37</td>\n",
       "      <td>0</td>\n",
       "      <td>-2.61</td>\n",
       "      <td>...</td>\n",
       "      <td>2.47</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.73</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.83</td>\n",
       "      <td>4</td>\n",
       "      <td>0.21</td>\n",
       "      <td>1</td>\n",
       "      <td>513</td>\n",
       "      <td>500.83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40914</th>\n",
       "      <td>1</td>\n",
       "      <td>-16.05</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.02</td>\n",
       "      <td>2</td>\n",
       "      <td>-1.77</td>\n",
       "      <td>3</td>\n",
       "      <td>5.56</td>\n",
       "      <td>2</td>\n",
       "      <td>5.22</td>\n",
       "      <td>...</td>\n",
       "      <td>2.47</td>\n",
       "      <td>2</td>\n",
       "      <td>-5.39</td>\n",
       "      <td>0</td>\n",
       "      <td>3.63</td>\n",
       "      <td>3</td>\n",
       "      <td>0.07</td>\n",
       "      <td>0</td>\n",
       "      <td>513</td>\n",
       "      <td>500.97</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>40915 rows × 23 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       term  term得分  fico_range_high  fico_range_high得分  installment  \\\n",
       "0         0    6.83                0              -5.02            1   \n",
       "1         0    6.83                0              -5.02            3   \n",
       "2         0    6.83                3              11.22            0   \n",
       "3         0    6.83                0              -5.02            0   \n",
       "4         0    6.83                0              -5.02            0   \n",
       "...     ...     ...              ...                ...          ...   \n",
       "40910     0    6.83                2               3.75            1   \n",
       "40911     0    6.83                3              11.22            3   \n",
       "40912     0    6.83                2               3.75            1   \n",
       "40913     0    6.83                0              -5.02            3   \n",
       "40914     1  -16.05                0              -5.02            2   \n",
       "\n",
       "       installment得分  tot_hi_cred_lim  tot_hi_cred_lim得分  mort_acc  \\\n",
       "0               4.28                1              -2.95         0   \n",
       "1              -5.37                3               5.56         0   \n",
       "2              16.68                1              -2.95         0   \n",
       "3              16.68                0              -6.37         2   \n",
       "4              16.68                2               2.48         0   \n",
       "...              ...              ...                ...       ...   \n",
       "40910           4.28                3               5.56         0   \n",
       "40911          -5.37                1              -2.95         0   \n",
       "40912           4.28                1              -2.95         0   \n",
       "40913          -5.37                0              -6.37         0   \n",
       "40914          -1.77                3               5.56         2   \n",
       "\n",
       "       mort_acc得分  ...  home_ownership得分  verification_status  \\\n",
       "0           -2.61  ...             -0.81                    1   \n",
       "1           -2.61  ...              2.47                    2   \n",
       "2           -2.61  ...             -2.50                    0   \n",
       "3            5.22  ...             -2.50                    1   \n",
       "4           -2.61  ...             -2.50                    1   \n",
       "...           ...  ...               ...                  ...   \n",
       "40910       -2.61  ...              2.47                    0   \n",
       "40911       -2.61  ...             -2.50                    0   \n",
       "40912       -2.61  ...              2.47                    0   \n",
       "40913       -2.61  ...              2.47                    1   \n",
       "40914        5.22  ...              2.47                    2   \n",
       "\n",
       "       verification_status得分  open_rv_24m  open_rv_24m得分  bc_util  bc_util得分  \\\n",
       "0                      -0.73            0           3.63        1      -0.22   \n",
       "1                      -5.39            1          -0.83        4       0.21   \n",
       "2                       4.05            0           3.63        0      -0.49   \n",
       "3                      -0.73            2          -3.44        5       0.35   \n",
       "4                      -0.73            3          -6.11        3       0.07   \n",
       "...                      ...          ...            ...      ...        ...   \n",
       "40910                   4.05            3          -6.11        0      -0.49   \n",
       "40911                   4.05            1          -0.83        0      -0.49   \n",
       "40912                   4.05            0           3.63        2      -0.07   \n",
       "40913                  -0.73            1          -0.83        4       0.21   \n",
       "40914                  -5.39            0           3.63        3       0.07   \n",
       "\n",
       "       loan_status  基础分      总分  \n",
       "0                0  513  511.42  \n",
       "1                0  513  510.77  \n",
       "2                0  513  551.77  \n",
       "3                0  513  520.04  \n",
       "4                0  513  524.01  \n",
       "...            ...  ...     ...  \n",
       "40910            0  513  535.64  \n",
       "40911            0  513  530.73  \n",
       "40912            0  513  533.22  \n",
       "40913            1  513  500.83  \n",
       "40914            0  513  500.97  \n",
       "\n",
       "[40915 rows x 23 columns]"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_pingfen_bins"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 评分分布"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(458.1, 591.68)"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_pingfen_bins['总分'].min(),data_pingfen_bins['总分'].max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAfoAAAG5CAYAAABm2faLAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAtqklEQVR4nO3df5yVdZ338dcnUFchFA1lLRVNt3Iz1CaFXaGh1I1MS/NH/sq7VAzKdpe8sxLzJiupds1yUSPIzKw0S8vWSFmdFbshdvD39stWJeVOwhhBXTcQP/cf1wWOw8CcgTPnMNe8no/HPDjne13nez7f4zjv872u77lOZCaSJK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q6Cvh3is/jd1f3dRSL8vx4ndRLXjBHGmAiYkhmPtfDPutXupdvDl6x7kI5ERFZxz8cZf9Rfi5/Y/u8MjOfqddzSgOJQS9JUoX5OXpJkirMoJckqcIMekmSKsyglySpwgx6SZIq7P8DAquh8fhcx98AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 576x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig=plt.figure(figsize=(8,7))\n",
    "bins = [400,480,490,500,520,540,560,600]\n",
    "n = pd.cut(data_pingfen_bins['总分'],bins = bins,include_lowest = True).value_counts(dropna = False,sort = False)\n",
    "row = []\n",
    "for i in range(len(bins) - 1):\n",
    "    if i != len(bins) - 2:\n",
    "        row.append('[' + '{}'.format(bins[i]) + ',' + '{}'.format(bins[i + 1]) + ']')\n",
    "    else:\n",
    "        row.append('(' + '{}'.format(bins[i]) + ',' + '{}'.format(bins[i + 1]) + ']')\n",
    "plt.bar(range(len(n.values)),n.values,color = 'rgb',tick_label = row)\n",
    "for x,y in zip(range(len(n.values)),n.values):\n",
    "    plt.text(x + 0.05,y + 0.05,'%.0f' %y, ha = 'center',va = 'bottom')\n",
    "plt.xlabel(\"分数段区间\") \n",
    "plt.ylabel(\"客户数\") \n",
    "plt.title(\"各分数段客户数统计\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 样本评分统计"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_y=data_pingfen_bins['loan_status']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [],
   "source": [
    "bins = [400,480,490,500,520,540,560,600]\n",
    "labels = ['G','F','E','D','C','B','A']\n",
    "\n",
    "result = pd.DataFrame()\n",
    "result['总分'] = data_pingfen_bins['总分']\n",
    "result['总分区间'] = pd.cut(data_pingfen_bins['总分'],bins = bins)\n",
    "result['总分区间等级'] = pd.cut(data_pingfen_bins['总分'],bins = bins,labels = labels)\n",
    "result['贷款状态'] = data_y"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>总分</th>\n",
       "      <th>总分区间</th>\n",
       "      <th>总分区间等级</th>\n",
       "      <th>贷款状态</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>511.42</td>\n",
       "      <td>(500, 520]</td>\n",
       "      <td>D</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>510.77</td>\n",
       "      <td>(500, 520]</td>\n",
       "      <td>D</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>551.77</td>\n",
       "      <td>(540, 560]</td>\n",
       "      <td>B</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>520.04</td>\n",
       "      <td>(520, 540]</td>\n",
       "      <td>C</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>524.01</td>\n",
       "      <td>(520, 540]</td>\n",
       "      <td>C</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>503.80</td>\n",
       "      <td>(500, 520]</td>\n",
       "      <td>D</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>516.86</td>\n",
       "      <td>(500, 520]</td>\n",
       "      <td>D</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>508.90</td>\n",
       "      <td>(500, 520]</td>\n",
       "      <td>D</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>511.52</td>\n",
       "      <td>(500, 520]</td>\n",
       "      <td>D</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>543.49</td>\n",
       "      <td>(540, 560]</td>\n",
       "      <td>B</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       总分        总分区间 总分区间等级  贷款状态\n",
       "0  511.42  (500, 520]      D     0\n",
       "1  510.77  (500, 520]      D     0\n",
       "2  551.77  (540, 560]      B     0\n",
       "3  520.04  (520, 540]      C     0\n",
       "4  524.01  (520, 540]      C     0\n",
       "5  503.80  (500, 520]      D     1\n",
       "6  516.86  (500, 520]      D     0\n",
       "7  508.90  (500, 520]      D     1\n",
       "8  511.52  (500, 520]      D     0\n",
       "9  543.49  (540, 560]      B     0"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result.head(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 评分卡区间分布"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   good_num  bad_num   bin_rate   bad_rate\n",
      "0       159      252   1.004522  61.313869\n",
      "1      3906     3080  17.074423  44.088176\n",
      "2     13776     5685  47.564463  29.212271\n",
      "3      9982     1898  29.035806  15.976431\n",
      "4      1909      179   5.103263   8.572797\n",
      "5        84        5   0.217524   5.617978\n"
     ]
    }
   ],
   "source": [
    "##简单的分数区间计算\n",
    "good_total = sum(data_pingfen_bins.loan_status == 0)\n",
    "bad_total = sum(data_pingfen_bins.loan_status == 1)\n",
    "score_bin = np.arange(450,625,25)\n",
    "bin_rate = []\n",
    "bad_rate = []\n",
    "#ks = []\n",
    "good_num = []\n",
    "bad_num = []\n",
    "for i in range(len(score_bin)-1):\n",
    "        ##取出分数区间的样本\n",
    "    if score_bin[i+1] == 600:\n",
    "        index_1 = (data_pingfen_bins.总分 >= score_bin[i]) & (data_pingfen_bins.总分 <= score_bin[i+1]) \n",
    "    else:\n",
    "        index_1 = (data_pingfen_bins.总分 >= score_bin[i]) & (data_pingfen_bins.总分 < score_bin[i+1]) \n",
    "    df_temp = data_pingfen_bins.loc[index_1,['loan_status','总分']]\n",
    "        ##计算该分数区间的指标\n",
    "    good_num.append(sum(df_temp.loan_status==0))\n",
    "    bad_num.append(sum(df_temp.loan_status==1))\n",
    "        ##区间样本率\n",
    "    bin_rate.append(df_temp.shape[0]/data_pingfen_bins.shape[0]*100)\n",
    "        ##坏样本率\n",
    "    bad_rate.append(df_temp.loan_status.sum()/df_temp.shape[0]*100)\n",
    "        ##以该分数为注入分数的ks值\n",
    "    #ks.append(sum(bad_num[0:i+1])/bad_total - sum(good_num[0:i+1])/good_total )\n",
    "        \n",
    "    \n",
    "df_result = pd.DataFrame({'good_num':good_num,'bad_num':bad_num,'bin_rate':bin_rate,\n",
    "                             'bad_rate':bad_rate}) \n",
    "print(df_result)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>good_num</th>\n",
       "      <th>bad_num</th>\n",
       "      <th>bin_rate</th>\n",
       "      <th>bad_rate</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>159</td>\n",
       "      <td>252</td>\n",
       "      <td>1.004522</td>\n",
       "      <td>61.313869</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>3906</td>\n",
       "      <td>3080</td>\n",
       "      <td>17.074423</td>\n",
       "      <td>44.088176</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>13776</td>\n",
       "      <td>5685</td>\n",
       "      <td>47.564463</td>\n",
       "      <td>29.212271</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>9982</td>\n",
       "      <td>1898</td>\n",
       "      <td>29.035806</td>\n",
       "      <td>15.976431</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1909</td>\n",
       "      <td>179</td>\n",
       "      <td>5.103263</td>\n",
       "      <td>8.572797</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>84</td>\n",
       "      <td>5</td>\n",
       "      <td>0.217524</td>\n",
       "      <td>5.617978</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   good_num  bad_num   bin_rate   bad_rate\n",
       "0       159      252   1.004522  61.313869\n",
       "1      3906     3080  17.074423  44.088176\n",
       "2     13776     5685  47.564463  29.212271\n",
       "3      9982     1898  29.035806  15.976431\n",
       "4      1909      179   5.103263   8.572797\n",
       "5        84        5   0.217524   5.617978"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_result"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
